package com.jg.blog.exception;

import com.jg.blog.enums.ResultEnum;

/**
 * @author 解来景
 * @date ${DATE} ${TIME}
 * @version 1.0
 */
public class BlogException extends RuntimeException {
    /**
     * 错误状态码
     */
    private Integer errorCode = ResultEnum.ERROR.getCode();

    public BlogException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.errorCode = resultEnum.getCode();
    }

    public BlogException(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public BlogException(String message, Integer errorCode) {
        super(message);
        this.errorCode = errorCode;
    }
    public BlogException(String message) {
        super(message);
    }

    public BlogException(String message, Throwable cause, Integer errorCode) {
        super(message, cause);
        this.errorCode = errorCode;
    }

    public BlogException(Throwable cause, Integer errorCode) {
        super(cause);
        this.errorCode = errorCode;
    }

    public BlogException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Integer errorCode) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.errorCode = errorCode;
    }

    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }
}
